Estimating processor load using peripheral adapter queue behavior

ABSTRACT

Techniques for estimating processor load by using queue depth information of a peripheral adapter provides processor loading information that can be used to adapt interrupt latency to improve performance in a processing system. A mathematical function of the depth of one or more queues of the adapter is compared to its historical value in order to provide an estimate of processor load. The estimated processor load can then be used to set a parameter that controls the frequency of an interrupt generator. The mathematical function may be the ratio of the transmit queue depth to the receive queue depth and the historical value may be predetermined, user-settable, obtained during a calibration interval or obtained by taking a long-term average of the mathematical function of the queue depths.

The Present Application is a Continuation of U.S. patent application Ser. No. 12/550,309, filed on Aug. 28, 2009, which is a Continuation of U.S. patent application Ser. No. 10/948,409, filed on Sep. 23, 2004.

BACKGROUND OF THE INVENTION

1. Technical Field

The present invention relates generally to computer systems having peripheral devices with input/output (I/O) queues, and more particularly, to techniques for estimating processor loading using peripheral transmit and receive queue depths.

2. Description of Related Art

Peripheral devices connected to a processing system typically interrupt one or more processors in order to signal the presence of receive data or absence of transmit data in device queues. In the past, an interrupt was generally generated upon receipt of a complete packet or when a complete packet had been transmitted. When an interrupt is processed, the processes triggered by the interrupt generally transfer all of the data that is available in the receive queue and likewise flush the system transmit queues by transferring transmit data to the adapter. However, when the system is experiencing a large volume of traffic, the resulting increased frequency of the interrupts received can reduce system efficiency, compounding any backlog of processing activity. Network adapters in particular have a high traffic level in today's server system and the processing overhead for handling packets can be very high, especially in a web server where the packets require a response and are not merely forwarded after minimal processing, such as in routing applications.

To solve the above-described problem, a technique known as “interrupt coalescing” has been introduced, which lessens the frequency of interrupts directed at the processor(s). Rather than interrupt at each packet transfer, present-day adapters accumulate data in queues that can accommodate multiple packets and interrupts are triggered at a lower frequency. In particular, present network adapters typically accumulate a large amount of data before interrupting the processor managing data transfer between the adapter and the host system. In part, a large data size associated with each interrupt is provided due to the overhead associated with each interrupt.

Several interrupt timing schemes have been implemented for interrupt coalescing. Three primary techniques are presently used. The first technique times a hold-off time interval from receipt of the first new packet after the last interrupt. Upon expiration of the timer, the processor is interrupted. The first technique provides adaptability only in that an interrupt will be held off for the instantaneous time between the last interrupt and completion of the first packet plus the predetermined time. If the processor is not busy, the first technique introduces undesired latency. A second technique is to interrupt after a predetermined number of packets has been received (queue depth threshold). The second technique may generate an even higher latency, as no interrupt is generated until the required number of packets is received. A third technique generates an interrupt if the frequency of packets receives drops below a predetermined threshold (received packet frequency threshold).

Each of the above-described techniques reduces interrupt overhead in the system. However, none of the techniques takes into account the processor load. Therefore, undesirable latency can be introduced when the processor is not busy and the design values such as the timer length for the first technique above, the packet count for the second technique above and the threshold value for the third technique above may not be the ideal values for high load conditions at the processor, but merely a compromise between latency and reduced interrupt overhead.

Peripheral devices other than network adapters also introduce overhead when interrupting on a per-packet basis, and therefore interrupt coalescing techniques have also been used in storage systems adapters, bus adapters such as Fiber Channel, IEEE 1394 and Universal Serial Bus (USB) adapters, with the associated problems described above.

BRIEF SUMMARY OF THE INVENTION

The invention is embodied in a method, apparatus, computer system and computer program product. The loading of a processor interfaced to a peripheral device is estimated in conformity with a current queue depth of interface I/O queues. The interrupt frequency of the interface may be adjusted in conformity with the estimated processor load, thereby providing an interrupt frequency that is dependent on the estimate of processor load. The ratio of the depth of the transmit queue to the depth of the receive queue can be used to provide an estimate of available processing time, as a large relative transmit queue depth indicates that the processor is keeping up with processing requirements, but a small relative transmit queue size is indicative of a processor that is lagging behind processing requirements. A historical value of the transmit/receive ratio can be maintained as a long-term average, may be set in a calibration interval, may be set by a user (system administrator) or may be a predetermined value. The divergence between the historical ratio and the instantaneous ratio provides further information about processor loading, and can be used to set parameters for interrupt coalescing, such as an interrupt hold-off time, a queue depth threshold or a received packet frequency threshold.

The foregoing and other objectives, features, and advantages of the invention will be apparent from the following, more particular, description of the preferred embodiment of the invention, as illustrated in the accompanying drawings.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWING

The novel features believed characteristic of the invention are set forth in the appended claims. The invention itself, however, as well as a preferred mode of use, further objectives, and advantages thereof, will best be understood by reference to the following detailed description of an illustrative embodiment when read in conjunction with the accompanying drawings, wherein like reference numerals indicate like components, and:

FIG. 1 is a block diagram of a computing system in accordance with an embodiment of the present invention.

FIG. 2 is a block diagram showing details of network adapter 20 of FIG. 1.

FIG. 3 is a flowchart depicting a method in accordance with an embodiment of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

With reference now to the figures, and in particular with reference to FIG. 1, there is depicted a block diagram of a processing system in accordance with an embodiment of the present invention. It should be understood that the depicted embodiment is not intended to be limiting, but only exemplary of the type of processing system to which the methods and structures of the present invention may be applied. The system includes a processor group 10A having two cores 12A and 12B and coupled to another processor group 10B by a high-speed dedicated interface 5A. Processor group 10A is connected to peripherals (hardware resources) 15 via a bridge 16. Cores 12A and 12B provide instruction execution and operation on data values for general-purpose processing functions, which include the processing of network data transfers between a network connection and processor group 10A via a network adapter 20. In particular, processor group 10A may be included in a web server providing web page files and other program code and data in response to web requests received over the network connection. Performance counters 2 are included to provide an operating system with information about processor load and other metrics within processor group 10A.

Processor group 10A also includes an L3 cache unit 17, a shared L2 cache unit 11 and a memory controller 14. Each processor group 10A, 10B is coupled to separate associated system local memory 18A, 18B and can access any system memory via the various interconnections. However, to maintain low latencies, program instructions for execution by processor 13A are generally stored in system local memory 18A so that values from system local memory can be loaded into caches 11 and 17 as quickly as possible. Other global system memory may be coupled external to bridge 16 for symmetrical access by all processor groups.

PCI bus 5 couples the various peripherals 15, as well as an interrupt controller 19 to bridge 16. Bridge 16 is also coupled by bus 5 to network adapter 20, which includes circuits and implements methodologies in accordance with embodiments of the present invention. Interrupt controller 19 provides interrupt signals INT to processor group 10A and interrupts one of cores 12A or 12B within processor group 10A in response to an interrupt request signal IRQ provided by network adapter 20.

Within system local memory 18A and or 18B, a virtual machine monitor program, or “hypervisor” provides support for execution of multiple virtual machines (VMs) or “partitions” that each provide an execution environment for an operating system and a number of “guest” programs (applications and services executed by an operating system and running in the associated VM). However, the techniques of the present invention are equally applicable to single partition systems including uniprocessor systems and the illustrated system is provided only as an example of the technology to which the present invention may be applied.

The present invention concerns the operation of network adapter 20 and in particular a mechanism for managing a frequency of interrupts issued by network adapter 20 to processor group 10A. Network adapter 20 may be an Ethernet adapter, an ATM interface or other network interface. In general, the present invention applies to any peripheral adapter that coalesces interrupts and therefore the illustration with respect to network adapter 20 should not be construed as limiting the invention to network packet processing. Therefore, the term “packet” as used herein should be understood to apply to a single unit of data with respect to the peripheral device in which the invention is embodied and terms such as “block” or “sector” for other types of peripheral device adapters such as storage adapters should be understood to be encompassed by the term “packet”. Also, the term “frequency” as applied to the interrupt control of the present invention should not be construed as meaning absolute frequency of a fixed period, but rather a relative and average frequency at which interrupts occur, as may be triggered at asynchronous, synchronous or quasi-synchronous intervals by network adapter 20.

Referring now to FIG. 2, details of network adapter 20 and the configuration thereof are illustrated. Network adapter 20 includes a network interface circuit 21 that connects to the network connection and a bus interface circuit 22 that couples the network interface circuit 21 to external PCI bus 5. Network adapter provides an interrupt request signal IRQ to interrupt controller 19 and manages the frequency of the IRQ assertions in accordance with an embodiment of the present invention.

Within network interface circuit 21 a set of data queues 24 is managed by a controller 27 which may be a microprocessor or microcontroller or dedicated logic circuit that handles the transfer of data into and out of data queues 24 to bus interface circuit 22 and further provides an interrupt generator 23 with a signal indicating when to interrupt external processor group 10A. The present invention includes further input to interrupt generator 23 so that the frequency of IRQ assertions can be tailored to the current processor load. In network-centric systems where processor group 10A is being loaded substantially with network-associated tasks, the relative depths of data queues 24 provides an indication of how busy processor group 10A is, and therefore whether increased interrupt frequency will tend to increase or decrease system performance.

When processor group 10A is busy processing network requests, the transmit data queue within data queues 24 will tend to starve, while the receive data queue will tend to fill up. It is under this condition that traditional interrupt coalescing methods can cause a downward spiral in performance, as the frequency of interrupts to the processor handling the network packets will be increased in order to attempt to keep up with the demand.

In the present invention, rather than rely solely on the frequency of packets received, the absolute depth of the receive queue, or the expiration of an interrupt time period, the present invention computes an estimate of processor load and reduces the relative interrupt frequency in conformity with the processor load estimate. A load estimator 25, which may in practice be an algorithm executed within controller 27, uses the relative instantaneous depths of the transmit and receive queues within data queues 24 to compute a ratio of transmit to receive queue depth. The transmit/receive queue depth ratio will drop as processor group 10A becomes busy trying to accommodate network requests and therefore provides a good metric of the processor load. Other metrics may be used depending on system conditions such as observing the transmit queue depth alone. However, the ratiometric comparison yields a better estimate of how well the processor is handling the network traffic load. When the receive queue is filling while the transmit queue is starved, the processor is likely busy handling network requests, whereas if both queues are relatively empty, the overall network traffic is likely to be low.

Load estimator 25 therefore provides a divider or other means for generating a ratio of transmit queue depth to receive queue depth and providing a result to interrupt generator 23, which may also in practice be an algorithm within controller 27. The result controls the frequency of interrupts generated by interrupt generator 23 and in the present embodiment is scaled by a historical value provided by a history unit 26 that further refines the interrupt frequency control result. History unit 26 determines a historical value of the transmit/receive queue depth ratio and load estimator 25 further divides the historical ratio by the instantaneous ratio computed as described above. The result can then be mapped in a linear (or alternatively a non-linear) function to control interrupt frequency by adjusting a parameter of the interrupt coalescing technique that is employed. The linear result may be used, for example, to control a timer value that times the interval from the first received packet after the last interrupt until the next interrupt, to control the receive queue depth at which an interrupt is issued, or to adjust a packet-frequency interrupt threshold.

The linear mapping maps the variation of the instantaneous ratio of the transmit to receive queue as normalized by the historical value to a parameter that controls the particular coalescing method employed by interrupt generator 23. For example, if the receive queue depth is the coalescing technique trigger and test results show that the interrupt overhead load on processor group 10A is effectively controlled by varying the receive queue depth interrupt threshold from a depth of Min to Max, then the following formulas may be employed:

Ratio=(Historical Tx/Rx ratio)/(Current Tx/Rx ratio)

where Tx=Transmit queue and Rx=Receive queue depth.

Receive Queue Interrupt Threshold=Min+(Max−Min)×(Ratio−K):Ratio>K

Min:Ratio<=K

where Min=minimum receive queue depth interrupt threshold and Max=maximum receive queue depth interrupt threshold and K is a predetermined threshold for the Ratio value.

The above formulas provide that the interrupt parameter (in this case the Receive Queue Interrupt Threshold) will never fall below the Min value, even if Ratio falls below a predetermined threshold for the linear mapping.

Similarly, a timed interrupt scheme can use the same formula given above. For example if the interrupt time from the first packet received ranges from Min to Max in order to effectively control the interrupt overhead processor load, then the timer value can be computed using the same formula, where the Min and Max values are expressed as interrupt delay times.

Finally, if the packet frequency of packets received by network adapter 20 is the control parameter and the interrupt overhead processor load can be effectively controlled by a threshold range of Min to Max in packets/sec, then the same formula may be employed to determine the packet frequency interrupt threshold.

The historical value determined by history unit 26 may be provided in several ways, including using the full range of values for the minimum Tx queue depth and maximum Rx queue depth ever encountered as the historical ratio. The simplest is a pre-set value that is determined a priori via measurement of a particular application and encoded in the network interface circuit. An alternative is to provide a user-settable register that may be set by a system administrator at set-up time, so that the interrupt frequency can be tailored to a specific application. Two other alternatives implement an averaging algorithm or provide an averaging circuit within history unit 26. A calibration interval may be initiated during which the instantaneous ratio of transmit to receive queue depths is averaged and then stored at the end of the calibration interval. The resulting averaged ratio is then used as the historical value for comparison with the instantaneous ratio during operation. Finally, history unit 26 may perform a long-term average over a predetermined interval, permitting the historical value to adapt to changes in operating conditions without requiring a separate calibration interval.

It should be further understood that the above examples are not an exhaustive list of interrupt frequency control techniques. For example, interrupts may also be generated as a function of transmit queue depth and so the interrupt coalescing parameter adjustment of the present invention may also be applied to scale the frequency of interrupts generated as a function of transmit queue depth as well.

Referring now to FIG. 3, a method in accordance with an embodiment of the invention is depicted. First, the instantaneous depths of the receive and transmit queues are measured (step 30). Next, a ratio of transmit queue depth to receive queue depth is computed as an estimate of processor load (step 31). The computed ratio is then compared to a historical value (which may be by computing another ratio) and the result is mapped as a linear function (step 32). Finally the interrupt-frequency controlling parameter of the interrupt generator is adjusted in conformity with the linear result (step 33). The process repeats until the system is shut down (decision 34).

While the invention has been particularly shown and described with reference to the preferred embodiment thereof, it will be understood by those skilled in the art that the foregoing and other changes in form, and details may be made therein without departing from the spirit and scope of the invention. 

1. A method of measuring a processor load of a processor in a computer system, the method comprising: first determining an amount of transmission data present in a transmit queue of a peripheral adapter coupled to the processor, wherein the transmit queue holds data for transmission to one or more peripheral connections; second determining an amount of received data present in a receive queue of the peripheral adapter, wherein the receive queue holds data received from the one or more peripheral connections; and computing a current estimate of the processor load from the amount of transmission data and the amount of received data.
 2. The method of claim 1, wherein the peripheral adapter is a network adapter and wherein the current estimate of processor load is an estimate of a network packet processing backlog of a processor.
 3. The method of claim 1, wherein the computing computes the current estimate of the processor load by computing a ratio of the amount of transmission data determined by the first determining to the amount of received data determined by the second determining.
 4. The method of claim 3, wherein the computing a current estimate of processor load further comprises comparing a current value of the ratio to a historical value for the ratio to obtain the current estimate of processor load.
 5. The method of claim 4, wherein the comparing comprises computing a second ratio of the current value of the ratio to the historical value.
 6. An interface circuit for receiving a peripheral connection, the interface circuit comprising: a receive data queue for storing data received by the peripheral connection; a transmit data queue for storing data for transmission to the peripheral connection; and a control logic including a load estimator for computing an estimate of a current processing load of the external processor from an amount of data in the receive data queue and another amount of data in the transmit data queue.
 7. The interface circuit of claim 6, wherein the peripheral connection is a network connection and wherein the estimate of current processing load is an estimate of a network packet processing backlog of the external processor.
 8. The interface circuit of claim 6, wherein the control logic comprises logic for computing a ratio of the amount of transmission data to the amount of received data.
 9. The interface circuit of claim 8, wherein the load estimator further comprises logic for comparing a current value of the ratio to a historical value for the ratio to obtain the current estimate of processor load.
 10. The interface circuit of claim 9, wherein the load estimator computes a second ratio of the current value of the ratio to the historical value to compare the current value of the ratio to the historical value of the ratio.
 11. A system comprising: a memory for storing program instructions and data; a processor for executing the program instructions; an interface for receiving a peripheral connection, wherein the interface is coupled to the processor and to an external processor, and wherein the interface has one or more data queues for storing data associated with a transfer over the peripheral connection with the external processor, and wherein the program instructions include program instructions for computing an estimate of a current processing load of the external processor from an amount of data in the receive data queue and another amount of data in the transmit data queue.
 12. The system of claim 11, wherein the peripheral connection is a network connection and wherein the estimate of current processing load is an estimate of a network packet processing backlog of the external processor.
 13. The system of claim 12, wherein the processor is a processor of a network adapter that includes the interface for receiving the network connection, and wherein the external processor is a processor that is coupled to the network adapter for processing data exchanged over the network connection.
 14. The system of claim 11, wherein the program instructions for computing the estimate comprise program instructions for computing a ratio of the amount of transmission data to the amount of received data.
 15. The system of claim 14, wherein the program instructions for computing the estimate further comprise program instructions for comparing a current value of the ratio to a historical value for the ratio to obtain the current estimate of processor load.
 16. The system of claim 15, wherein the program instructions for computing the estimate further comprise program instructions for computing a second ratio of the current value of the ratio to the historical value to compare the current value of the ratio to the historical value of the ratio.
 17. A computer program product comprising a computer-readable storage device storing program instructions for execution by a processor, wherein the program instructions comprise program instructions for computing an estimate of a current processing load of an external processor from an amount of data in a receive data queue and another amount of data in a transmit data queue of a peripheral connection coupled to the processor and the external processor.
 18. The computer program product of claim 17, wherein the program instructions for computing the estimate comprise program instructions for computing a ratio of the amount of transmission data to the amount of received data.
 19. The computer program product of claim 18, wherein the program instructions for computing the estimate further comprise program instructions for comparing a current value of the ratio to a historical value for the ratio to obtain the current estimate of processor load.
 20. The computer program product of claim 19, wherein the program instructions for computing the estimate further comprise program instructions for computing a second ratio of the current value of the ratio to the historical value to compare the current value of the ratio to the historical value of the ratio. 